package ac.rfr.manager;
import java.awt.BorderLayout;
import java.awt.Dimension;
import java.util.HashSet;
import java.util.Set;

import javax.swing.DefaultListModel;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JList;
import javax.swing.JScrollPane;
import javax.swing.border.TitledBorder;

import ac.notification.event.INotificationListenerLite;
import ac.rfr.ui.MainWindow;
import ac.rfr.ui.UIComponentLibrary;


public class HistoryListManager implements INotificationListenerLite  {

	public interface ExportedComponents{
		public static final String HLM_LIST_VIEW 				= "HLM_LIST_VIEW";
		public static final String HLM_LIST_MODEL 			= "HLM_LIST_MODEL";
		public static final String HLM_LIST_TITLE_LABEL 	= "HLM_LIST_TITLE_LABEL";
	}
	
	private JList list;
	private DefaultListModel listModel;
	private JLabel titleLabel;
	
	public HistoryListManager()
	{
		initComponents();
		registerListeners();
		exportComponents();
	}
	
	private void exportComponents() {
		UIComponentLibrary.addComponent(ExportedComponents.HLM_LIST_VIEW, list);
		UIComponentLibrary.addComponent(ExportedComponents.HLM_LIST_TITLE_LABEL,titleLabel );
		UIComponentLibrary.addComponent(ExportedComponents.HLM_LIST_MODEL, listModel);
	}
	private void registerListeners() {
		
	}

	private void initComponents() {
		
		titleLabel = new JLabel(" Contnents ");
		listModel = new DefaultListModel(); 
		list = new JList(listModel);

		listModel.addElement("No File..");
		
		JScrollPane scrollPane = new JScrollPane(list);
		scrollPane.setColumnHeaderView(titleLabel);
		scrollPane.setBorder(new TitledBorder("Recent Files"));
		scrollPane.setPreferredSize(new Dimension(200, 600));
		
		
		JFrame frame = (JFrame) UIComponentLibrary.getComponent(MainWindow.ExportedComponents.MW_MAIN_WINDOW);
		frame.getContentPane().add(scrollPane,BorderLayout.WEST);
	}



	@Override
	public Set<String> declaredSubscriptionSet() {
		Set<String> subscriptionSet = new HashSet<String>();
		return subscriptionSet;
	}

	@Override
	public void receiveEvent(String arg0) {
		
	}

}
